$(document).ready(function() {

	$('.signaturebox').each(function() {
		var sig = $(this);
		var url = sig.attr("id");
		$.get(url, function(data) {
		  sig.html(data);
		  //alert('Load was performed. data='+data + " url="+url);
		});
	});

	
	$('.comment-reply-ref').click(function(){
		var commentId = $(this).attr("id");
		var commentBodyId = "#commentbody-"+commentId;
		var commentAuthorId = "#commentauthor-"+commentId;
		
	    var author = $(commentAuthorId).html();
	    
	    var comment = $(commentBodyId).html();
	
	    var insertStr = '<blockquote cite="' + commentBodyId + '">';
	    insertStr += '\n<strong><a href="#comment-' + commentId + '">' + author.replace(/\t|\n|\r\n/g, "") + '</a> :</strong>';
	    insertStr += comment.replace(/\t/g, "");
	    insertStr += '</blockquote>';
	
		$("#comment").val(insertStr + $("#comment").val());
		$("#parentCommentUid").val(commentId);
	
	});

	$('.comment-reply-link').click(function(){
		var commentId = $(this).attr("id"); 
		$("#parentCommentUid").val(commentId);
	
	});

	$('#reprintarticleurl').each(function(){
		var url = $(this).attr("title");
		$.getJSON(url, function(data) {
			$("#reprintarticle_name").html(data.article.name);			 
			$("#reprintarticle_name_input").val(data.article.name);	
			
			$("#reprintarticle_tags").html(data.article.tags);			 
			$("#reprintarticle_tags_input").val(data.article.tags);	
					 
			$("#reprintarticle_groupTag").html(data.article.groupTag);			 
			$("#reprintarticle_groupTag_input").val(data.article.groupTag);	
					 
			$("#reprintarticle_longDesc").html(data.article.longDesc);			 
			$("#reprintarticle_longDesc_input").val(data.article.longDesc);	
					 
		});
	});
	
	$('#gotop').click(function(){
		$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );		
	});
});